package operation;

import book.Book;
import book.BookLise;

import java.util.Scanner;

public class FindOperation implements IOperation {
    @Override
    public void work(BookLise bookLise) {
        System.out.println("查找图书");

        System.out.println("请输入你需要查找的图书名字");
        Scanner scanner = new Scanner(System.in);
        String name = scanner.nextLine();
        for (int i = 0; i < bookLise.getNowSize(); i++) {
            if(name.equals(bookLise.getBooks(i).getName())){
                System.out.println("找到了");
                System.out.println(bookLise.getBooks(i));
                return;
            }
        }
        System.out.println("未找到");
    }
}
